﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Principal;
using System.Configuration;
using System.Reflection;

namespace XCommunity
{
  public static class CommunityContext
  {
    public static ICommunityContext CurrentContext
    {
      get
      {

        XCommunitySection section = (XCommunitySection) ConfigurationManager.GetSection( "xcommunity" );

        var method = section.ContextType.GetMethod( "GetCurrentContext", BindingFlags.Static | BindingFlags.Public );
        return (ICommunityContext) method.Invoke( null, null );
      }
    }

    public static IIdentity CurrentIdentity
    {
      get { return CurrentContext.CurrentAccount; }
    }


  }
}
